{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 经验宗旨\n",
    "\n",
    "1. 掌握**设计模式**是做大型项目的必备基础。项目越大越难管理，良好的设计思路能让你的项目层次分明，易于扩展，要把整体设计思路形象的展示出来，方便给人讲解，也可以此做为开发的参照，遇到不合理的地方及时标注、探讨和改进，始终以此为开发基准，保证不偏离的开发方向。在项目一开始就划分好好整个项目的功能模块，模块之间的交互方式和消息格式，达到独立、易扩展、高可用的状态。\n",
    "\n",
    "2. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 检查对象类型\n",
    "\n",
    "1. inspect 模块的各种 isxxx 方法，🍎配合其源码可查看到该类型应具有的魔法属性，有助于进阶提高python水平\n",
    "\n",
    "2. types: inspect 实际上也是通过 types模块判断的\n",
    "3. typing： 也是大量引用的types模块实现\n",
    "\n",
    "## 获取文档字符串\n",
    "\n",
    "1. 直接取对象的`__doc__` 属性\n",
    "2. `inspect.getdoc()`\n",
    "\n",
    "## 获取对象类名\n",
    "\n",
    "实例化后用`__class__.__name__`，未实例化的类属性为 `__name__`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Foo:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Foo'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f = Foo()\n",
    "f.__class__.__name__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Foo'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Foo.__name__"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 自定义日志类\n",
    "\n",
    "学习一下paho.mqtt.client 中的_easy_log"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "168px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
